package com.mes.prepare.domain;

import java.util.Date;

import com.mes.basicdata.domain.Dept;
import com.mes.basicdata.domain.Device;
import com.mes.basicdata.domain.Employee;
import com.mes.basicdata.domain.Part;
import com.mes.basicdata.domain.TypesData;
import com.mes.common.domain.BasicModel;
import com.mes.task.domain.OperationTask;

/*import com.mes.basicdata.persistence.domain.Dept;
import com.mes.basicdata.persistence.domain.Device;
import com.mes.basicdata.persistence.domain.Employee;
import com.mes.basicdata.persistence.domain.Part;
import com.mes.basicdata.persistence.domain.TypesData;
import com.mes.common.model.BasicModel;
import com.mes.task.persistence.domain.OperationTask;*/

/**
 * ����׼��������
 * 
 * @author niukay created on April 23th, 2013
 */
public class PrepareTask extends BasicModel
{
	private static final long serialVersionUID = 1L;

	public static final String PREPARE_TASKSTATE_WARN = "204";
	public static final String PREPARE_TASKSTATE_CREATED = "201";
	public static final String PREPARE_TASKSTATE_UNDISPATCH = "205";
	public static final String PREPARE_TASKSTATE_DISPATCHED = "206";
	public static final String PREPARE_TASKSTATE_START = "207";
	public static final String PREPARE_TASKSTATE_POSTPONE = "208";
	public static final String PREPARE_TASKSTATE_FINISH = "209";
	public static final String PREPARE_TASKSTATE_CANCEL = "210";

	public static final String PREPARE_TASKTYPE_JUDGE = "101";
	public static final String PREPARE_TASKTYPE_DATA = "201";
	
	public static final String PREPARE_TASKTYPE_SORT = "301";
	public static final String PREPARE_TASKTYPE_SORT_QUESTION = "302";
	
	public static final String PREPARE_TASKTYPE_DELIVERY = "401";
	public static final String PREPARE_TASKTYPE_BACKUP = "501";

	public static final String PREPARE_TASKTYPE_JUDGE_EXCEED = "601";
	public static final String PREPARE_TASKTYPE_DATA_EXCEED = "602";
	public static final String PREPARE_TASKTYPE_SORT_EXCEED = "603";

	public static final String PREPARE_TASKTYPE_OTHER = "701";
	
	public static final String PREPARE_TASKTYPE_ROUTING = "801";
	public static final String PREPARE_TASKTYPE_ROUTING_QUESTION = "802";
	
	public static final String PREPARE_STATE_JUDGE_ORDER = "100";
	public static final String PREPARE_STATE_DATA_ORDER = "200";
	public static final String PREPARE_STATE_SORT_ORDER = "300";
	public static final String PREPARE_STATE_NOPREPARE = "500";

	public static final Long ONEDAY = 60L * 60L * 24L;
	public static final Long TWODAYS = ONEDAY * 2L;
	public static final Long THREEDAYS = ONEDAY * 3L;
	public static final Long FIVEDAYS = ONEDAY * 5L;
	public static final Long ONEWEEK = ONEDAY * 7L;
	public static final Long FORTNIGHT = ONEDAY * 14L;
	public static final Long ONEMONTH = ONEDAY * 30L;
	public static final Long THREEMONTH = ONEDAY * 90L;

	public static final Long HIGHSTAGE = 3L;
	public static final Long MEDIUMSTAGE = 2L;
	public static final Long LOWSTAGE = 1L;

	protected String prepareTaskUid;
	protected String prepareTaskName;
	protected String prepareTaskType;
	protected TypesData prepareTaskTypeDesc;
	protected String prepareTaskState;
	protected TypesData prepareTaskStateDesc;

	protected Long priority;
	protected String creatorUid;
	// protected Employee creator;
	protected Date createTime;

	protected String employeeId;
	protected Employee employee;

	protected String relationId;
	protected String partUid;
	protected String orderId;

	protected String taskUid;
	protected OperationTask operationTask;
	protected String deptId;
	protected Dept dept;

	protected String taskPartNumber;
	protected Part taskPart;
	protected String taskDrawingid;
	protected String taskVersionid;
	protected String taskBatchnum;
	protected Date taskPlanStart;
	protected String routing;
	protected String routingVer;
	protected String opuid;
	protected Double operationId;
	protected String operationIddesc;
	protected String taskTaskid;
	protected String taskTaskName;
	protected String taskTaskType;
	protected Double taskTaskState;

	protected String resuid;
	protected Device device;
	protected String relationOrder;

	protected Date startTime;
	protected Date endTime;
	protected Date finalTime;
	protected Date nextTime;

	protected Date actualStart;
	protected Date estimateFinish;
	protected Date actualFinish;

	protected String notes;
	protected String scheduleTaskUid;
	protected Double completePercent;
	
	//SHT 14/03/14
	protected String taskDescription;
	protected String dispatcher;
	protected Date dispatchTime;
	protected Employee dispatch;

	public String getUuid()
	{
		return this.prepareTaskUid;
	}

	public void setUuid(String uuid)
	{
		this.prepareTaskUid = uuid;
	}

	public String getPrepareTaskUid()
	{
		return prepareTaskUid;
	}

	public void setPrepareTaskUid(String prepareTaskUid)
	{
		this.prepareTaskUid = prepareTaskUid;
	}

	public String getPrepareTaskName()
	{
		return prepareTaskName;
	}

	public void setPrepareTaskName(String prepareTaskName)
	{
		this.prepareTaskName = prepareTaskName;
	}

	public String getPrepareTaskType()
	{
		return prepareTaskType;
	}

	public void setPrepareTaskType(String prepareTaskType)
	{
		this.prepareTaskType = prepareTaskType;
	}

	public TypesData getPrepareTaskTypeDesc()
	{
		// prepareTaskTypeDesc.getIdDescription();

		return prepareTaskTypeDesc;
	}

	public void setPrepareTaskTypeDesc(TypesData prepareTaskTypeDesc)
	{
		this.prepareTaskTypeDesc = prepareTaskTypeDesc;
	}

	public String getPrepareTaskState()
	{
		return prepareTaskState;
	}

	public void setPrepareTaskState(String prepareTaskState)
	{
		this.prepareTaskState = prepareTaskState;
	}

	public TypesData getPrepareTaskStateDesc()
	{
		// prepareTaskStateDesc.getIdDescription();

		return prepareTaskStateDesc;
	}

	public void setPrepareTaskStateDesc(TypesData prepareTaskStateDesc)
	{
		this.prepareTaskStateDesc = prepareTaskStateDesc;
	}

	public Long getPriority()
	{
		return priority;
	}

	public void setPriority(Long priority)
	{
		this.priority = priority;
	}

	public String getCreatorUid()
	{
		return creatorUid;
	}

	public void setCreatorUid(String creatorUid)
	{
		this.creatorUid = creatorUid;
	}

	// public Employee getCreator()
	// {
	// return creator;
	// }
	//
	// public void setCreator(Employee creator)
	// {
	// this.creator = creator;
	// }

	public Date getCreateTime()
	{
		return createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	public String getEmployeeId()
	{
		return employeeId;
	}

	public void setEmployeeId(String employeeId)
	{
		this.employeeId = employeeId;
	}

	public Employee getEmployee()
	{
		return employee;
	}

	public void setEmployee(Employee employee)
	{
		this.employee = employee;
	}

	public String getRelationId()
	{
		return relationId;
	}

	public void setRelationId(String relationId)
	{
		this.relationId = relationId;
	}

	public String getPartUid()
	{
		return partUid;
	}

	public void setPartUid(String partUid)
	{
		this.partUid = partUid;
	}

	public String getOrderId()
	{
		return orderId;
	}

	public void setOrderId(String orderId)
	{
		this.orderId = orderId;
	}

	public String getTaskUid()
	{
		return taskUid;
	}

	public void setTaskUid(String taskUid)
	{
		this.taskUid = taskUid;
	}

	public OperationTask getOperationTask()
	{
		return operationTask;
	}

	public void setOperationTask(OperationTask operationTask)
	{
		this.operationTask = operationTask;
	}

	public String getDeptId()
	{
		return deptId;
	}

	public void setDeptId(String deptId)
	{
		this.deptId = deptId;
	}

	public String getTaskPartNumber()
	{
		return taskPartNumber;
	}

	public void setTaskPartNumber(String taskPartNumber)
	{
		this.taskPartNumber = taskPartNumber;
	}

	public Part getTaskPart()
	{
		return taskPart;
	}

	public void setTaskPart(Part taskPart)
	{
		this.taskPart = taskPart;
	}

	public String getTaskDrawingid()
	{
		return taskDrawingid;
	}

	public void setTaskDrawingid(String taskDrawingid)
	{
		this.taskDrawingid = taskDrawingid;
	}

	public String getTaskVersionid()
	{
		return taskVersionid;
	}

	public void setTaskVersionid(String taskVersionid)
	{
		this.taskVersionid = taskVersionid;
	}

	public String getTaskBatchnum()
	{
		return taskBatchnum;
	}

	public void setTaskBatchnum(String taskBatchnum)
	{
		this.taskBatchnum = taskBatchnum;
	}

	public Date getTaskPlanStart()
	{
		return taskPlanStart;
	}

	public void setTaskPlanStart(Date taskPlanStart)
	{
		this.taskPlanStart = taskPlanStart;
	}

	public String getRouting()
	{
		return routing;
	}

	public void setRouting(String routing)
	{
		this.routing = routing;
	}

	public String getRoutingVer()
	{
		return routingVer;
	}

	public void setRoutingVer(String routingVer)
	{
		this.routingVer = routingVer;
	}

	public String getOpuid()
	{
		return opuid;
	}

	public void setOpuid(String opuid)
	{
		this.opuid = opuid;
	}

	public Double getOperationId()
	{
		return operationId;
	}

	public void setOperationId(Double operationId)
	{
		this.operationId = operationId;
	}

	public String getOperationIddesc()
	{
		return operationIddesc;
	}

	public void setOperationIddesc(String operationIddesc)
	{
		this.operationIddesc = operationIddesc;
	}

	public String getTaskTaskid()
	{
		return taskTaskid;
	}

	public void setTaskTaskid(String taskTaskid)
	{
		this.taskTaskid = taskTaskid;
	}

	public String getTaskTaskName()
	{
		return taskTaskName;
	}

	public void setTaskTaskName(String taskTaskName)
	{
		this.taskTaskName = taskTaskName;
	}

	public String getTaskTaskType()
	{
		return taskTaskType;
	}

	public void setTaskTaskType(String taskTaskType)
	{
		this.taskTaskType = taskTaskType;
	}

	public Double getTaskTaskState()
	{
		return taskTaskState;
	}

	public void setTaskTaskState(Double taskTaskState)
	{
		this.taskTaskState = taskTaskState;
	}

	public String getResuid()
	{
		return resuid;
	}

	public void setResuid(String resuid)
	{
		this.resuid = resuid;
	}

	public Device getDevice()
	{
		return device;
	}

	public void setDevice(Device device)
	{
		this.device = device;
	}

	public String getRelationOrder()
	{
		return relationOrder;
	}

	public void setRelationOrder(String relationOrder)
	{
		this.relationOrder = relationOrder;
	}

	public Date getStartTime()
	{
		return startTime;
	}

	public void setStartTime(Date startTime)
	{
		this.startTime = startTime;
	}

	public Date getEndTime()
	{
		return endTime;
	}

	public void setEndTime(Date endTime)
	{
		this.endTime = endTime;
	}

	public Date getFinalTime()
	{
		return finalTime;
	}

	public void setFinalTime(Date finalTime)
	{
		this.finalTime = finalTime;
	}

	public Date getNextTime()
	{
		return nextTime;
	}

	public void setNextTime(Date nextTime)
	{
		this.nextTime = nextTime;
	}

	public Date getActualStart()
	{
		return actualStart;
	}

	public void setActualStart(Date actualStart)
	{
		this.actualStart = actualStart;
	}

	public Date getEstimateFinish()
	{
		return estimateFinish;
	}

	public void setEstimateFinish(Date estimateFinish)
	{
		this.estimateFinish = estimateFinish;
	}

	public Date getActualFinish()
	{
		return actualFinish;
	}

	public void setActualFinish(Date actualFinish)
	{
		this.actualFinish = actualFinish;
	}

	public String getNotes()
	{
		return notes;
	}

	public void setNotes(String notes)
	{
		this.notes = notes;
	}

	public String getScheduleTaskUid()
	{
		return scheduleTaskUid;
	}

	public void setScheduleTaskUid(String scheduleTaskUid)
	{
		this.scheduleTaskUid = scheduleTaskUid;
	}

	public Double getCompletePercent()
	{
		return completePercent;
	}

	public void setCompletePercent(Double completePercent)
	{
		this.completePercent = completePercent;
	}

	public Long getSurplusTime()
	{
		Long finalTime_num = finalTime == null ? 0L : finalTime.getTime();
		Long nowerTime_num = (new Date()).getTime();
		Long surplusTime = finalTime_num - nowerTime_num;

		return surplusTime;
	}

	public String toString()
	{
		String presentStr = "prepareTaskUid:" + prepareTaskUid
				+ ", prepareTaskType:" + prepareTaskType
				+ ", prepareTaskState:" + prepareTaskState + "," + " priority:"
				+ priority + ", notes:" + notes;

		return presentStr;
	}

	public String getTaskDescription() {
		return taskDescription;
	}

	public void setTaskDescription(String taskDescription) {
		this.taskDescription = taskDescription;
	}

	public String getDispatcher() {
		return dispatcher;
	}

	public void setDispatcher(String dispatcher) {
		this.dispatcher = dispatcher;
	}

	public Date getDispatchTime() {
		return dispatchTime;
	}

	public void setDispatchTime(Date dispatchTime) {
		this.dispatchTime = dispatchTime;
	}

	public Employee getDispatch() {
		return dispatch;
	}

	public void setDispatch(Employee dispatch) {
		this.dispatch = dispatch;
	}

	public Dept getDept() {
		return dept;
	}

	public void setDept(Dept dept) {
		this.dept = dept;
	}	
	
}
